package com.penglecode.netty3.example3;

import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;

import com.penglecode.netty.codec.protostuff.ProtostuffObjectDecoder;
import com.penglecode.netty.codec.protostuff.ProtostuffObjectEncoder;
import com.penglecode.protostuff.runtime.ProtostuffSerializer;

public class ServerChannelPipelineFactory implements ChannelPipelineFactory {

	public ChannelPipeline getPipeline() throws Exception {
		ChannelPipeline channelPipeline = Channels.pipeline();
		channelPipeline.addLast("serverdecoder", new ProtostuffObjectDecoder(new ProtostuffSerializer()));
		channelPipeline.addLast("serverencoder", new ProtostuffObjectEncoder(new ProtostuffSerializer()));
		channelPipeline.addLast("serverhandler", new ServerApplicationCommandHandler());
		return channelPipeline;
	}

}
